package com.svse.designPattern.structure.proxy.impl;

import com.svse.designPattern.structure.proxy.service.Subject;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/7/26 18:01
 */
public class Proxy implements Subject {

    private  RealSubject realSubject;
    @Override
    public void Request() {
        if (realSubject==null)
        {
            realSubject=new RealSubject();
        }
        preRequest();
        realSubject.Request();
        postRequest();
    }
    public void preRequest()
    {
        System.out.println("访问真实主题之前的预处理。");
    }
    public void postRequest()
    {
        System.out.println("访问真实主题之后的后续处理。");
    }
}
